package cn.itrip.service.Impl;

import cn.itrip.dao.ItripUserMapper;
import cn.itrip.entity.ItripUser;
import cn.itrip.service.ItripUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

@Service
public class ItripUserServiceImpl extends ServiceImpl<ItripUserMapper,ItripUser> implements ItripUserService {
    @Override
    public ItripUser login(String userCode, String password) {
        ItripUser user = getBaseMapper().getByUserCode(userCode);
        if (user!=null&&user.getUserPassword().equals(password)){
            return user;
        }
        return null;
    }

    @Override
    public boolean exists(String userCode) {
        return getBaseMapper().getByUserCode(userCode) != null;
    }
}
